/**   
 * @Title: BeidanHotAgainstInfoCommunicater.java 
 * @Package com.esun.rabbit2.communicaters.beijingdanchang 
 * @Description: 热门赛事对阵信息
 * @author: Kael gaojian@500wan.com   
 * @date: 2012-4-9 下午17:00:00  
 * Copyright: (C) 2011 Shenzhen E-sun Sky Net Technology Co.,ltd.
 */
package com.esun.rabbit2.communicaters.beijingdanchang;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Hashtable;

import javax.xml.parsers.ParserConfigurationException;

import org.apache.http.client.ClientProtocolException;
import org.xml.sax.SAXException;

import com.esun.config.BussinessCode;
import com.esun.config.Key;
import com.esun.model.beijingdanchang.BeidanAgainstInfo;
import com.esun.network.ServerCommunicater;
import com.esun.util.HashMapUtil;

/**
 * @ClassName: BeidanHotAgainstInfoCommunicater
 * @Description: 热门赛事对阵信息
 * @author:  Kael gaojian@500wan.com  
 * @date: 2012-4-9 下午17:00:00 
 * 
 */
public class BeidanHotAgainstInfoCommunicater extends ServerCommunicater {
	private boolean isSucceed = true;
	public boolean isGetInfoSucceed() throws ClientProtocolException, IOException, ParserConfigurationException, SAXException {
		ArrayList<HashMap<String, String>> arraylist = new ArrayList<HashMap<String, String>>();
		arraylist.add(HashMapUtil.getMapItem(BussinessCode.PASER_MID, BussinessCode.MID_BEIDAN_HOTAGAINSTINFO));
		// 写入服务器返回信息
		super.getServerResponse(arraylist, true);
		if (super.getState() == 100) {
			isSucceed = true;
		} else {
			isSucceed = false;
		}
		return isSucceed;
	}
	public ArrayList<BeidanAgainstInfo> getAgainstInfoList() {

		ArrayList<BeidanAgainstInfo> beiDanAgainstInfos = new ArrayList<BeidanAgainstInfo>();
		Hashtable<String, String>hashtable = new Hashtable<String, String>();
		for (int i = 0; i < super.getListResult().size(); i++) {
			BeidanAgainstInfo beiDanAgainstInfo = new BeidanAgainstInfo();
			hashtable = super.getListResult().get(i);
			beiDanAgainstInfo.setExpect(super.getResult().get(Key.KEY_EXPECT));//期号
			beiDanAgainstInfo.setMatchDate(hashtable.get(Key.KEY_MATCHDATE));//比赛归属日
			beiDanAgainstInfo.setMatchWeek(hashtable.get(Key.KEY_MATCHWEEK));//比赛所属星期
			beiDanAgainstInfo.setSchedulesDate(hashtable.get(Key.KEY_SCHEDULESDATE));//
			beiDanAgainstInfo.setId(hashtable.get(Key.KEY_ID));
			beiDanAgainstInfo.setOrderNum(hashtable.get(Key.KEY_ORDERNUM));//序号
			beiDanAgainstInfo.setSimpleLeague(hashtable.get(Key.KEY_LEAGUEMATCHNAME));//联赛名
			beiDanAgainstInfo.setHomeSxName(hashtable.get(Key.KEY_HOMESXNAME));//主队
			beiDanAgainstInfo.setGuestSxName(hashtable.get(Key.KEY_GUESTSXNAME));//客队
			beiDanAgainstInfo.setEndTime(hashtable.get(Key.KEY_ENDTIME));//截止时间
			beiDanAgainstInfo.setxId(hashtable.get(Key.KEY_XID));
			beiDanAgainstInfo.setProcessName(hashtable.get(Key.KEY_PROCESSNAME));
			beiDanAgainstInfo.setRangqiu(hashtable.get(Key.KEY_RANGQIU));
			beiDanAgainstInfo.setC1(hashtable.get(Key.KEY_C1));
			beiDanAgainstInfo.setC3(hashtable.get(Key.KEY_C3));
			beiDanAgainstInfo.setC5(hashtable.get(Key.KEY_C5));

			beiDanAgainstInfos.add(beiDanAgainstInfo);
		}
		return beiDanAgainstInfos;
	}
}
